<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>H+ 后台主题UI框架 - 空白页</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <!-- <link rel="shortcut icon" href="favicon.ico"> -->
      <!-- <link rel="shortcut icon" href="favicon.ico"> -->
   <link href="__STATIC__/layout/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__STATIC__/layout/css/font-awesome.css?v=4.4.0" rel="stylesheet">
     <link href="__STATIC__/layout/css/plugins/summernote/summernote.css" rel="stylesheet">
    <link href="__STATIC__/layout/css/plugins/summernote/summernote-bs3.css" rel="stylesheet">
     <link rel="stylesheet" type="text/css" href="__STATIC__/layout/css/plugins/webuploader/webuploader.css">
    <link rel="stylesheet" type="text/css" href="__STATIC__/layout/css/demo/webuploader-demo.css">
    <!-- jqgrid-->
    <link href="__STATIC__/layout/css/animate.css" rel="stylesheet">
    <link href="__STATIC__/layout/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="__STATIC__/layout/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="__STATIC__/layout/css/gyq.css" rel="stylesheet">
    <link rel="stylesheet" href="__STATIC__/layout/css/demo.css" type="text/css">
    <style>
    </style>
</head>

<body style="color:#333;padding:3px;" class="x_sorll">
    <!-- 标题 -->
    <div class="page-heade">
      <h2 class="title_color text-center">销售费用核销面单-预览</h2>
    </div>
    <!-- 标题 -->
    <div >
    <form action="" class="form-inline" id="f1">
   
    <textarea name="form-data" style="display: none;">{$datastr}</textarea>
    <input type="hidden" value="" name="state" id="ste"/>
    <input type="hidden" value="{$apply.jxs_id}" name="jxs"/>
      <table class="table table-bordered bud_hei text-center" style="margin-top:0">
         <tr>
            <td style="min-width: 140px;width: 140px;">申请人</td>
            <td class="text-left"><a href="javascript:;">{$user.em_name}</a></td>
             <td style="min-width: 140px;width: 140px;">所属部门/职位</td>
            <td class="text-left">{$user.de_name}/{$user.job_name}</td>
             <td style="min-width: 140px;width: 140px;">提交时间</td>
            <td class="text-left">{$time}</td>
         </tr>
         <tr>
            <td style="min-width: 140px;width: 140px;">经销商名称</td>
            <td colspan="5" class="text-left">{$apply.jxs}</td>
         </tr>
         <tr>
            <td colspan="6" class="text-left">
                <p class="font-bold colorRed">温馨提示：请在发票粘贴联上注明此申请单编号<a href="javascript:;">点击查看图例</a></p>
                <p class="font-bold colorRed">并邮寄至：签收。(如邮寄地址未显示，请联系相关人员进行邮寄地址添加)</p>
            </td>
         </tr>
      </table>
      <table class="table table-striped table-bordered bud_hei text-center">
          <tr class="info">
            <th class="text-center" rowspan="2">序号</th>
            <th class="text-center" rowspan="2">原申请人</th>
            <th class="text-center" rowspan="2">原申请文件</th>
            <th class="text-center" rowspan="2">明细编号</th>
            <th class="text-center" rowspan="2">核查结果</th>
            <th class="text-center" rowspan="2">网点名称</th>
            <th class="text-center" rowspan="2">系统名称</th>
            <th class="text-center" rowspan="2">品牌</th>
            <th class="text-center" rowspan="2">三级费用科目</th>
            <th class="text-center" colspan="3">实际投入</th>
            <th class="text-center" colspan="8">本次申请核销</th>
             <th class="text-center" rowspan="2">活动开始日期</th>
             <th class="text-center" rowspan="2">支付方式</th>
             <th class="text-center" rowspan="2">备注</th>
          </tr>
          <tr class="info">
            <th class="text-center">实际投入金额(未税)</th>
            <th class="text-center">已核销金额</th>
            <th class="text-center">未核销金额</th>
            <th class="text-center">未税核销金额</th>
            <th class="text-center">
            有无发票
            </th>
             <th class="text-center">
            发票号</th>
             <th class="text-center">
            是否增值税<br>(可抵扣)
            </th>
             <th class="text-center">
            税率
            </th>
           <th class="text-center">税金</th> 
           <th class="text-center">含税核销金额</th> 
           <th class="text-center">实际核销金额</th> 
          </tr>
          {volist name="ade" id="vo"}
			<tr>
				<td>{$i}</td><td>{$vo.cname}</td><td><a href="javascript:;" onclick="xiangqing({$vo.apid})">{$vo.no}</a></td><td>{$vo.no}_{$vo.detail_no}</td><td>无</td>
				 <td><a href="javascript:;">{$vo.net_name}*</a></td>
          		<td><a href="javascript:;">{$vo.sys_name}*</a></td> <td>{$vo.brand_name}</td><td>{$vo.kemu3}</td> 
          		<td class="ObjectNum num2i ">{$vo.fankuijine}</td>
          <td class="ObjectNum num2i">{$vo.hexiao}</td>
          <td class="ObjectNum num2i weihec">{$vo.weihe}</td>
          		{volist name="postdata" id="vo1" key="j"}
          			{if condition="$vo.id eq $vo1.did"}
          				<td class="ObjectNum weishuihe">{$vo1.weishui}</td><td>{if condition="$vo1.isfa eq 1"}有{else/}无{/if}</td><td>{$vo1.fapiao}</td>
          				<td>{if condition="$vo1.isdi eq 1"}是{else/}否{/if}</td><td>{$vo1.shuilv}%</td><td class="ObjectNum shuijin">{$vo1.shuijin}</td>
          				<td class="ObjectNum hanshui">{$vo1.hanshui}</td><td class="ObjectNum">{if condition="$vo1.isdi eq 1"}{$vo1.weishui}{else/}{$vo1.hanshui}{/if}</td><td>{$vo.start_time}</td>
                  <td>
                    {volist name="fipay" id="vof" key="h"}
                      {if condition="$vo1.zfid eq $vof.id"}
                      {$vof.title}
                      {/if}
                    {/volist}
                  </td>

                  <td>{$vo1.beizhu}</td>
          			{/if}
          		{/volist}
			</tr>
          {/volist}
  
          <tfoot>
            <tr class="text-right">
              <td colspan="9" class="font-bold">合计</td>
              <td class="ObjectNum zongshiji">10800</td>
              <td class="ObjectNum" id="zongyihe">0</td>
              <td class="ObjectNum" id="zongweihe">10800</td>
              <td class="ObjectNum" id="zongweishuihe">10800</td>
              <td></td>
              <td></td>
              <td></td>
              <td></td>
              <td class="ObjectNum" id="zongshuijin">10800</td>
              <td class="ObjectNum zonghanshui">10800</td>
              <td class="ObjectNum zongshiji">10800</td>
              <td colspan="3"></td>
            </tr>
          </tfoot>
      </table>
      <table class="table-bordered table">
          <tr>
            <td class="text-center" style="min-width: 120px;width: 120px;min-height:50px;height: 50px; ">备注:</td>
            <td><textarea name="remark" id="" class="form-control" style="width: 60%;overflow: auto;">{$zongbeizhu}</textarea><span style="vertical-align: bottom;">(500)</span></td>
          </tr>
          <tr>
              <td class="text-center" style="min-width: 120px;width: 120px">归档提醒</td>
              <td><input type="checkbox" name="isgui">(温馨说明:若设置归档提醒，则该申请归档后系统会自动发送邮件及弹出框提醒您)</td>
          </tr>
      </table>
     <div class="form-group white-bg" style="margin:20px 10px 20px 20px;">
            <div id="uploader" class="wu-example">
                <!--用来存放文件信息-->
                <div id="thelist" class="uploader-list">
                  
                </div>
                <div class="btns">
                    <div id="picker">选择文件</div>
                    <button id="ctlBtn" class="btn btn-default">开始上传</button>
                </div>
                <input type="hidden" name="attach" id="attach" >
            </div>
            <span>注：最多上传15个文件，每个文件小于50M,支持格式：</span><br>jpg,bnp,gif,png,jpeg,tif,raw,doc,docx,xls,xlsx,ppt,pptx,txt,pdf,rar,zip,mp4,avi,rmvb,rm,mid,3gp,AVI,3GP,,mpg,mp3,wma,wav
        </div>
      <div class="row sub_btn" style="width:100%;text-align:center;padding: 20px 0">
        <input type="button" class="btn btn-success" onclick="baocun(1)" value="保存为草稿">
        <input type="button" class="btn btn-primary" onclick="baocun(3)" value="保存并提交流程">
        <input type="button" class="btn btn-primary" onclick="fanhui()" value="返回列表">
    </div>
    </form>
    </div>
     <script src="__STATIC__/layout/js/jquery.min.js?v=2.1.4"></script>
    <script src="__STATIC__/layout/js/bootstrap.min.js?v=3.3.6"></script>
    <!-- <script src="js/plugins/metisMenu/jquery.metisMenu.js"></script> -->
    <script src="__STATIC__/layout/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
    <script src="__STATIC__/layout/js/plugins/layer/laydate/laydate.js"></script>
     <script src="__STATIC__/layout/js/plugins/sweetalert/sweetalert.min.js"></script>
       <script src="__STATIC__/layout/js/common.js"></script>
      <script src="__STATIC__/layout/js/plugins/layer/layer.min.js"></script>

      <script>
      //详情页
     function xiangqing(aid){
     var index = layer.open({
                            type:2,
                            title:'常规促销申请',
                            area:['100%','100%'],
                            maxmin:true,
                            content:'{:url("apply_de")}?aid='+aid
                        })
}        
      function baocun(state){
        $("#ste").val(state);
         $.ajax({
                        cache: true,
                        type: "POST",
                        url:"{:url('TiApply/hexiaochuli')}",
                        data:$('#f1').serialize(),// 你的formid
                        async: false,
                        error: function(requests) {
                            alert("Connection error");
                        },
                        success: function(datas) {
                          //alert(datas);
                          
                          var res1=JSON.parse(datas);
                          if(res1["state"]==1){
                            swal({
                            title: "完成",
                            text: "操作已成功",
                            type: "success"
                            },function(){
                              
                             location.href="{:url('TiApply/index')}"
                            });

                                  }else{
                                    swal({
                            title: "错误",
                            text:  res1["msg"],
                            type: "warning"
                            });
                                  }
                          }
                    });
      }
      function fanhui(){
        location.href="{:url('TiApply/index')}";
      }
      $(function(){
        hesuanshiji();hesuanyihe();hesuanweihe();hesuanweishuihe();hesuanshuijin();hesuanhanshui();
        var $ObjectNum =$(".ObjectNum");
               toNum($ObjectNum);
              
      })
       //核算总
       function hesuanhanshui(){
        var sum=0;
        $(".hanshui").each(function(){
          sum+=parseFloat($(this).html().replace(',',''));
          //alert(sum);
        })
        $(".zonghanshui").html(sum.toFixed(2));
      }  
       //核算税金
       function hesuanshuijin(){
        var sum=0;
        $(".shuijin").each(function(){
          sum+=parseFloat($(this).html().replace(',',''));
          //alert(sum);
        })
        $("#zongshuijin").html(sum.toFixed(2));
      }  
      //核算未税
       function hesuanweishuihe(){
        var sum=0;
        $(".weishuihe").each(function(){
          sum+=parseFloat($(this).html().replace(',',''));
          //alert(sum);
        })
        $("#zongweishuihe").html(sum.toFixed(2));
      }  
      //核算未核
       function hesuanweihe(){
        var sum=0;
        $(".weihe").each(function(){
          sum+=parseFloat($(this).html().replace(',',''));
          //alert(sum);
        })
        $("#zongweihe").html(sum.toFixed(2));
      }  
      //核算已核
       function hesuanshiji(){
        var sum=0;
        $(".shijifei").each(function(){
          sum+=parseFloat($(this).html().replace(',',''));
          //alert(sum);
        })
        $(".zongshiji").html(sum.toFixed(2));
      }  
      //核算实际费用
      function hesuanyihe(){
        var sum=0;
        $(".yihe").each(function(){
          sum+=parseFloat($(this).html().replace(',',''));
          //alert(sum);
        })
        $("#zongyihe").html(sum.toFixed(2));
      }  
        
      </script>
      <script type="text/javascript">
    // 添加全局站点信息
    var BASE_URL = '__STATIC__/layout/js/plugins/webuploader';
</script>
<script src="__STATIC__/layout/js/plugins/webuploader/webuploader.min.js"></script>
     <script>

       // 文件上传
    jQuery(function() {
        var $ = jQuery,
            $list = $('#thelist'),
            $btn = $('#ctlBtn'),
            state = 'pending',
            uploader;

        var ids = [];
        uploader = WebUploader.create({

            // 不压缩image
            resize: false,

            // swf文件路径
            swf: BASE_URL + '/js/Uploader.swf',

            // 文件接收服务端。
            server: '{:url("upload/fileupload")}',

            // 选择文件的按钮。可选。
            // 内部根据当前运行是创建，可能是input元素，也可能是flash.
            pick: '#picker'
        });

        // 当有文件添加进来的时候
        uploader.on( 'fileQueued', function( file ) {
            $list.append( '<div id="' + file.id + '" class="item">' +
                '<h4 class="info">' + file.name + '</h4>' +
                '<p class="state">等待上传...</p>' +
                '</div>' );
        });

        // 文件上传过程中创建进度条实时显示。
        uploader.on( 'uploadProgress', function( file, percentage ) {
            var $li = $( '#'+file.id ),
                $percent = $li.find('.progress .progress-bar');

            // 避免重复创建
            if ( !$percent.length ) {
                $percent = $('<div class="progress progress-striped active">' +
                    '<div class="progress-bar" role="progressbar" style="width: 0%">' +
                    '</div>' +
                    '</div>').appendTo( $li ).find('.progress-bar');
            }

            $li.find('p.state').text('上传中');

            $percent.css( 'width', percentage * 100 + '%' );
        });

        uploader.on( 'uploadSuccess', function( file,response) {
            if(response.success)
                ids.push(response.id)
            $( '#'+file.id ).find('p.state').text(response.msg);
        });

        uploader.on( 'uploadError', function( file ) {
            $( '#'+file.id ).find('p.state').text('上传出错');
        });

        uploader.on( 'uploadComplete', function( file ) {
            $('#attach').val(ids.join(','))
            $( '#'+file.id ).find('.progress').fadeOut();
        });

        uploader.on( 'all', function( type ) {
            if ( type === 'startUpload' ) {
                state = 'uploading';
            } else if ( type === 'stopUpload' ) {
                state = 'paused';
            } else if ( type === 'uploadFinished' ) {
                state = 'done';
            }

            if ( state === 'uploading' ) {
                $btn.text('暂停上传');
            } else {
                $btn.text('开始上传');
            }
        });

        $btn.on( 'click', function() {
            if ( state === 'uploading' ) {
                uploader.stop();
            } else {
                uploader.upload();
            }
            return false
        });

       
    });
    </script>
</body>

</html>